Skip to content

Fix user attribute fallback #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

jacobvosmaer
Copy link

For some of the omniauth user attributes that omniauth-ldap fetches from the LDAP server we have a list of fallback options in case an attribute is missing, for example:

'email' => ['mail', "email", 'userPrincipalName']

This means that if the LDAP object for the user does not have a mail attribute, omniauth-ldap will try the email attribute, and then the userPrincipalName attribute.

This attribute fallback was broken. In this PR we cherry-pick the upstream commits that fix this functionality, and we modified the tests to catch future regressions.

syndicut and others added 3 commits January 31, 2014 09:28
Conflicts:
	spec/omniauth/strategies/ldap_spec.rb
The first email attribute we check for is 'mail', then 'email'. By
returning an 'email' attribute in the test response we trigger the
fallback to the second attribute. This makes a test fail.
Net::LDAP::Entry returns empty array if key not
exists, so we should check for key with respond_to?
@ghost
Copy link

ghost commented Feb 1, 2014

I believe this should be fixed now that PR #10 was applied.

@jacobvosmaer
Copy link
Author

It is. Thanks @jhollingsworth !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants